<!--
    ACTUALLY NOT USED
-->

<script language=javascript>
    function changer(id){
        var rado= document.getElementById('an_renovee_'+id);

        var option2= document.getElementById('checkbox_reneve_'+id)

        if(option2.checked){
            rado.disabled=false;
     
        }else{
            rado.disabled=true;
        }
    
    }
</script>

<?php
// Give the header's title and the previous page's link
function CreateWalls($id) {
    echo '
        <table id="wallsTab">
            <tr>
                <td class="paddingCell">
                    ' . TXT_ORIENTATION . '
                </td>
                <td>
                    <select id="orientation" name="orientation' . $id . '" >
                        <option selected value="' . TXT_PLEASE_SELECT_AN_OPTION . '">' . TXT_PLEASE_SELECT_AN_OPTION . '</option>
                        <option value="1">' . TXT_NORTH . '</option>
                        <option value="2">' . TXT_EAST . '</option>
                        <option value="3">' . TXT_SOUTH . '</option>
                        <option value="4">' . TXT_WEST . '</option>
                    </select> 
                    <span style="padding-left:100px;">Rénové <input onclick=changer("' . $id . '")  type="checkbox" id="checkbox_reneve_' . $id . '" value="" > </span>
                                   <span >Année rénovation <input disabled=true type="number" id="an_renovee_' . $id . '" value="" > </span>
                </td>
            </tr>
   
            <tr>
                <td class="paddingCell">' . TXT_CONTINUITY . '</td>
                <td>
                    <select id="continuity" name="continuity' . $id . '">
                        <option selected value="' . TXT_PLEASE_SELECT_AN_OPTION . '">' . TXT_PLEASE_SELECT_AN_OPTION . '</option>
                        <option value="1">' . TXT_OUTSIDE_AIR . '</option>
                        <option value="2">' . TXT_UNHEATED_ROOM . '</option> 
                        <option value="3">' . TXT_HEATED_ROOM . '</option>
                        <option value="4">' . TXT_LAND . '</option>
                    </select> 
                </td>
            </tr>
            <tr>
                <td class="paddingCell">' . TXT_HEIGHT . '</td>
                <td><input id="wallHeigth' . $id . '" type="number" name="wallHeigth' . $id . '" /> &nbsp;mètres</td>
            </tr>
            <tr>
                <td class="paddingCell">' . TXT_LENGTH . '</td>
                <td><input id="wallLength' . $id . '" type="number" name="wallLength' . $id . '" /> &nbsp;mètres</td>
            </tr>
        </table>
    ';
}
?>
<script type="text/javascript">
    var orientation = new LiveValidation(<?php echo "'orientation" . TXT_PLEASE_SELECT_AN_OPTION . "'" ?>,  {onlyOnSubmit: true });
    orientation.add(Validate.Exclusion, { within: [ <?php echo "'" . TXT_PLEASE_SELECT_AN_OPTION . "'" ?> ], failureMessage: <?php echo "'" . TXT_FAILURE_CHOOSE_AN_ORIENTATION . "'" ?> } )
        
    var continuity = new LiveValidation('continuity', {onlyOnSubmit: true });
    continuity.add(Validate.Exclusion, { within: [ <?php echo "'" . TXT_PLEASE_SELECT_AN_OPTION . "'" ?> ], failureMessage: <?php echo "'" . TXT_FAILURE_CHOOSE_A_CONTINUITY_TYPE . "'" ?> } )

    var wallHeigth = new LiveValidation('wallHeigth');
    wallHeigth.add( Validate.Presence, { failureMessage: <?php echo "'" . TXT_FAILURE_CANNOT_BE_EMPTY . "'" ?> } );
    wallHeigth.add(Validate.Numericality);
    wallHeigth.add(Validate.Length, { minimum: 1, maximum: 5 } );     

    var wallLength = new LiveValidation('wallLength');
    wallLength.add( Validate.Presence );
    wallLength.add(Validate.Numericality);
    wallLength.add(Validate.Length, { minimum: 1, maximum: 5 } );        
        
</script> 